package com.example.testdemoutils.dynamic_data_source.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.testdemoutils.dynamic_data_source.dao.DatasourceDao;
import com.example.testdemoutils.dynamic_data_source.dao.SysUserDao;
import com.example.testdemoutils.dynamic_data_source.po.Datasource;
import com.example.testdemoutils.dynamic_data_source.po.SysUserEntity;
import com.example.testdemoutils.dynamic_data_source.service.DatasourceService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class DatasourceServiceImpl extends ServiceImpl<DatasourceDao, Datasource> implements DatasourceService {
    @Resource
    SysUserDao sysUserDao;

    @Override
    public SysUserEntity queryTableList(String dbKey, String userName) {
        QueryWrapper<SysUserEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("username", userName);
        SysUserEntity sysUserEntity = sysUserDao.selectOne(queryWrapper);

        SysUserEntity sysUserEntity1 = sysUserDao.queryByUserName(userName);
        return sysUserEntity1;
    }
}
